package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.internetofthings.firefightingiot;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot.DeviceSwitchService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: DeviceSwitchController
 * @Date: Created in 9:46 2023/2/20
 * @Description: 开关量控制器
 */
@Action
@RequestMapping(value="fireFightingIOT/switch")
public class DeviceSwitchController {

    @Resource
    private DeviceSwitchService deviceSwitchService;

    /**
     * @Author YangYu
     * @Description 开关列表
     * @Date Created in 17:19 2022/10/10
     * @Param [jsonParam]
     */

    @At(value = "deviceSwitchList", method = RequestMethod.GET,param = {"transDeviceCode"})
    public RespEntity deviceSwitchList(@RequestBody(required = false) JSONObject jsonParam) {
        return deviceSwitchService.deviceSwitchList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 开关详情
     * @Date Created in 17:19 2022/10/10
     * @Param [jsonParam]
     */

    @At(value = "deviceSwitchDetail", method = RequestMethod.GET,param = {"id"})
    public RespEntity deviceSwitchDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return deviceSwitchService.deviceSwitchDetail(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 开关新增、编辑
     * @Date Created in 17:19 2022/10/10
     * @Param [jsonParam]
     */

    @At(value = "deviceSwitchAddOrUpdate", method = RequestMethod.POST,param = {"number"})
    public RespEntity deviceSwitchAddOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return deviceSwitchService.deviceSwitchAddOrUpdate(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 开关删除
     * @Date Created in 17:19 2022/10/10
     * @Param [jsonParam]
     */

    @At(value = "deviceSwitchDel", method = RequestMethod.POST,param = {"id"})
    public RespEntity deviceSwitchDel(@RequestBody(required = false) JSONObject jsonParam) {
        return deviceSwitchService.deviceSwitchDel(jsonParam);
    }
}
